package com.ah.shanxi_demo.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 工单优先级枚举
 * @author zt 2020/8/24
 */
public enum OrderLevelEnum implements PolicyCommonInterface {

    //工单状态
    ORDER_LEVEL_1("1", "低"),
    ORDER_LEVEL_2("2", "中"),
    ORDER_LEVEL_3("3", "高"),

    ;

    private String key;
    private String value;

    final static Map<String, OrderLevelEnum> cacheOrderLevel = new HashMap<>(values().length);

    static {
        for (OrderLevelEnum orderLevelEnum : values()) {
            cacheOrderLevel.put(orderLevelEnum.key, orderLevelEnum);
        }
    }


    OrderLevelEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static OrderLevelEnum convert(String key) {
        OrderLevelEnum type = cacheOrderLevel.get(key);
        return type;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public Integer getKeyInt() {
        return Integer.parseInt(key);
    }
}

